import request from '@/utils/request'


// 查询预拉单列表
export function fixedConfiglist(data) {
  return request({
    url: '/fixedConfig/list',
    method: 'get',
    params: data
  })
}

// 新增预拉单
export function fixedConfigadd(data) {
  return request({
    url: '/fixedConfig',
    method: 'post',
    data: data
  })
}

// 编辑预拉单
export function fixedConfigedit(data) {
  return request({
    url: '/fixedConfig',
    method: 'put',
    data: data
  })
}

// 删除预拉单
export function delfixedConfig(fixedConfigId) {
  return request({
    url: '/fixedConfig/' + fixedConfigId,
    method: 'delete'
  })
}

// 查看预拉单剩余数量
export function fixedTradeNum(userId, amount, channelCode) {
  return request({
    url: `/pay/fixedTradeNum/${userId}/${amount}/${channelCode}`,
    headers: {
      isToken: false
    },
    method: 'get'
  })
}

// 预拉单状态
export function fixedConfigStatus(fixedConfigId, state) {
  return request({
    url: `/fixedConfig/updateStatus/${fixedConfigId}/${state}`,
    method: 'get'
  })
}

// 预拉单状态
export function fixedConfigFixed(fixedConfigId, fixed) {
  return request({
    url: `/fixedConfig/updateFixed/${fixedConfigId}/${fixed}`,
    method: 'get'
  })
}

// 创建固额订单
export function fixedAmountOrder(amount, channelCode) {
  return request({
    url: `/pay/fixed/${amount}/${channelCode}`,
    method: 'get'
  })
}
